package com.mxpio.erp.common.quality.entity;

import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "V_MB_ERP_INSPECTION_BILL_UNQUALIFIED_PARTS")
@Schema(description="采购件不合格")
public class VEInspectionBillUnqualifiedParts implements DictAble, Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Generator(policy = UUIDPolicy.class)
    @Column(name = "ID_", length = 64)
    @Schema(description = "ID主键")
    private String id;

    @Schema(description = "申请时间（年月）")
    @Column(name = "YEAR_MONTH_")
    private String yearMonth;

    @Column(name = "TYPE_")
    @Schema(description = "不良类型")
    private String type;

    @Column(name = "QUANTITY_")
    @Schema(description = "数量")
    private BigDecimal quantity;

    @Column(name = "LAST_MONTH_")
    @Schema(description = "上月占比")
    private BigDecimal lastMonth;

    @Column(name = "LAST_YEAR_")
    @Schema(description = "累计占比")//按年统计
    private BigDecimal lastYear;

    @Transient
    private Map<String, String> textMap;
    public String putText(String key, String value) {
        if (textMap == null) {
            textMap = new HashMap<>();
        }
        return textMap.put(key, value);
    }
}
